#ifndef __DK_CONF__
#define __DK_CONF__

#include <global/header/types.h>

#define LD_SYM(x) __LD_##x

#include <dde_kit/memory.h>
#include <dde_kit/printf.h>
#include <dde_kit/pcireg.h>
#include <dde_kit/thread.h>
#include <dde_kit/types.h>
#include <dde_kit/resources.h>
#include <dde_kit/panic.h>
#include <dde_kit/pci.h>
#include <dde_kit/assert.h>
#include <dde_kit/initcall.h>
#include <dde_kit/dde_kit.h>
#include <dde_kit/timer.h>
#include <dde_kit/pgtab.h>
#include <dde_kit/semaphore.h>
#include <dde_kit/interrupt.h>
#include <dde_kit/lock.h>

#include <proc/ips.h>
#include <proc/proc.h>
#include <proc/timer.h>

#define DK_TIMER_COUNT 128

struct dde_kit_timer
{ timer_t timer; };

#define DK_THREAD_NAME_LEN 20
#define DK_THREAD_COUNT    128

struct dde_kit_thread
{
	 int    free;
	 char   name[DK_THREAD_NAME_LEN + 1];
	 int    proc_id;
	 void  *data;
};

enum { pci_res_bus, pci_res_mem, pci_res_io, pci_res_max };

struct pci_bus_t;

struct pci_dev_t
{
	 uint32_t dev;
	 uint32_t func;

	 uint32_t dev_id;
	 uint32_t dev_class;

	 uint32_t reg_base[6];
	 uint32_t reg_size[6];
	 uint8_t irq_line;
};

struct pci_func_t
{
	 struct pci_bus_t *bus;	// Primary bus for bridges
	 struct pci_dev_t dev;	 
};

struct pci_bus_t
{
	 struct pci_func_t *parent_bridge;
	 uint32_t busno;
};

/* intr */
struct dk_irq_hook_s
{
	 int attach;
	 semaphore_t sem;
	 uint32_t sc;
	 uint32_t rc; 
	 void (*thread_init)(void *);
	 void (*handler)(void *);
	 void *priv;
	 proc_t proc;
};

#endif
